﻿using Diablo3.Services.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace Diablo3.Services.Model.Profiles
{
    [DataContract]
    public class Hero
    {
        #region Properties

        /// <summary>
        /// The name
        /// </summary>
        [DataMember(Name = "name")]
        private string _name = null;
        /// <summary>
        /// Gets the name.
        /// </summary>
        /// <value>
        /// The name.
        /// </value>
        public string Name
        {
            get { return this._name; }
        }

        /// <summary>
        /// The level
        /// </summary>
        [DataMember(Name = "level")]
        private int _level = 0;
        /// <summary>
        /// Gets the level.
        /// </summary>
        /// <value>
        /// The level.
        /// </value>
        public int Level
        {
            get { return this._level; }
        }

        /// <summary>
        /// The hardcore
        /// </summary>
        [DataMember(Name = "hardcore")]
        private bool _hardcore = false;
        /// <summary>
        /// Gets a value indicating whether this <see cref="Hero" /> is hardcore.
        /// </summary>
        /// <value>
        ///   <c>true</c> if hardcore; otherwise, <c>false</c>.
        /// </value>
        public bool Hardcore
        {
            get { return this._hardcore; }
        }

        /// <summary>
        /// The id
        /// </summary>
        [DataMember(Name = "id")]
        private long _id = 0;
        /// <summary>
        /// The hero id
        /// </summary>
        [DataMember(Name = "heroId")]
        private long _heroId = 0;
        /// <summary>
        /// Gets the id.
        /// </summary>
        /// <value>
        /// The id.
        /// </value>
        public long Id
        {
            get
            {
                if (this._id > 0)
                {
                    return this._id;
                }
                else if (this._heroId > 0)
                {
                    return this._heroId;
                }
                else
                {
                    return 0;
                }
            }
        }

        /// <summary>
        /// The gender
        /// </summary>
        [DataMember(Name = "gender")]
        private int _gender = 0;
        /// <summary>
        /// Gets the gender.
        /// </summary>
        /// <value>
        /// The gender.
        /// </value>
        public int Gender
        {
            get { return this._gender; }
        }

        /// <summary>
        /// The paragon level
        /// </summary>
        [DataMember(Name = "paragonLevel")]
        private int _paragonLevel = 0;
        /// <summary>
        /// Gets the paragon level.
        /// </summary>
        /// <value>
        /// The paragon level.
        /// </value>
        public int ParagonLevel
        {
            get { return this._paragonLevel; }
        }

        /// <summary>
        /// The class
        /// </summary>
        [DataMember(Name = "class")]
        private string _class = null;
        /// <summary>
        /// Gets the class.
        /// </summary>
        /// <value>
        /// The class.
        /// </value>
        public string Class
        {
            get { return this._class; }
        }

        /// <summary>
        /// The last updated
        /// </summary>
        [DataMember(Name = "lastUpdated")]
        private long _lastUpdated = 0;
        /// <summary>
        /// Gets the last updated.
        /// </summary>
        /// <value>
        /// The last updated.
        /// </value>
        public DateTimeOffset LastUpdated
        {
            get { return this._lastUpdated.ToUnixTimestamp(); }
        }

        /// <summary>
        /// The dead
        /// </summary>
        [DataMember(Name = "dead")]
        private bool _dead = false;
        /// <summary>
        /// Gets a value indicating whether this <see cref="Hero" /> is dead.
        /// </summary>
        /// <value>
        ///   <c>true</c> if dead; otherwise, <c>false</c>.
        /// </value>
        public bool Dead
        {
            get { return this._dead; }
        }

        #endregion

        #region Ctor

        /// <summary>
        /// Initializes a new instance of the <see cref="Hero" /> class.
        /// </summary>
        public Hero()
        {
        }

        #endregion
    }
}
